<?php
/**
 * Created by PhpStorm.
 * User: 王凯林
 * Date: 18/4/11
 * Time: 20:48
 */

namespace App\Service;


use App\Common\Model\ShopAccount;
use App\Model\MemberLevel;

class MemberLevelService
{
    //计算出等级的收益额度
    public function compute($uid)
    {
        //1.根据用户的uid去accounts表查等级
        //2.根据level查member_level查times
        //3.计算并返回写入收益额度的值
        $accinfo = ShopAccount::where('uid',$uid)->first();
        $record = MemberLevel::where('id',$accinfo->level)->first();
        return $record->level_money*$record->times;
    }
}